// 问题图片绑定事件
function bindQuestionPic(a) {
    return;
	
	$("#qleftimagewidth_" + a).bind("keydown", 
    function(b) {
        onlyInputNum(b, false)
    });
    $("#qleftimageheight_" + a).bind("keydown", 
    function(b) {
        onlyInputNum(b, false)
    });
    $("#qleftimagewidth_" + a).bind("focus", 
    function(b) {
        if ($.trim($(this).val()) == QIMAGE_DEFAULT_WIDTH_TEXT) {
            $(this).val("");
            $(this).removeClass("gray9")
        }
        $("#qleftimagetype4_" + a).attr("checked", true);
        checkQImgType(a, 4)
    });
    $("#qleftimagewidth_" + a).bind("blur", 
    function(b) {
        if ($.trim($(this).val()) == "") {
            $(this).val(QIMAGE_DEFAULT_WIDTH_TEXT);
            $(this).addClass("gray9")
        }
    });
    $("#qleftimageheight_" + a).bind("focus", 
    function(b) {
        if ($.trim($(this).val()) == QIMAGE_DEFAULT_HEIGHT_TEXT) {
            $(this).val("");
            $(this).removeClass("gray9")
        }
        $("#qleftimagetype4_" + a).attr("checked", true);
        checkQImgType(a, 4)
    });
    $("#qleftimageheight_" + a).bind("blur", 
    function(b) {
        if ($.trim($(this).val()) == "") {
            $(this).val(QIMAGE_DEFAULT_HEIGHT_TEXT);
            $(this).addClass("gray9")
        }
    });
    $("#qleftuploadimg").uploadify({
        uploader: ctx + "/js/uploadify/uploadify.swf?var=" + (new Date()).getTime(),
        script: ctx + "/json/media/uploadpic;jsessionid=" + jsessionid,
        scriptData: {},
        cancelImg: ctx + "/js/uploadify/cancel.png",
        buttonImg: ctx + "/images/picup_btn.gif",
        height: 35,
        folder: "/uploads",
        fileExt: "*.jpg;*.gif;*.png",
        fileDesc: "Image Files(*.jpg, *.gif, *.png)",
        fileDataName: "uploadfile",
        sizeLimit: 2 * 1024 * 1024,
        queueID: "replacing_area_pic",
        onComplete: function(f, b, e, c, g) {
            if (c != "" && c.indexOf("totalSizeLimit") > 0) {
                tips(" 抱歉，超过最大容量限制！", "error", null, 2005);
                return false
            } else {
                var d = $.evalJSON(c);
                if (d.error == "0") {
                    saveQImgAction(a, 1, d.msg)
                } else {
                    tips(" 上传出错，请重新上传！", "error", null, 2005);
                    return false
                }
            }
        },
        onError: function(e, b, d, c) {
            if (c.type == "File Size") {
                tips("抱歉，图片文件应小于2MB！", "error", null, 2005);
                return false
            } else {
                tips(" 图片上传出错，请重新上传！", "error", null, 2005);
                return false
            }
        },
        auto: true
    })
}

// 上传绑定
function bindQuestionUploadPic(b) {
    bindQuestionPic(b.id);
    if (b.typeid == 1 && (b.type == 1 || b.type == 2)) {
        if (b.answers != null) {
            for (var a = 0; a < b.answers.length; a++) {
                bindQuestionAnswerPic(b.id, b.answers[a].id)
            }
        }
    }
}

// 答案图片绑定
function bindQuestionAnswerPic(b, a) {
	return;
	
    $("#qleftanswerimagewidth_" + b + "_" + a).bind("keydown", 
    function(c) {
        onlyInputNum(c, false)
    });
    $("#qleftanswerimageheight_" + b + "_" + a).bind("keydown", 
    function(c) {
        onlyInputNum(c, false)
    });
    $("#qleftanswerimagewidth_" + b + "_" + a).bind("focus", 
    function(c) {
        if ($.trim($(this).val()) == AIMAGE_DEFAULT_WIDTH_TEXT) {
            $(this).val("");
            $(this).removeClass("gray9")
        }
        $("#qleftanswerimagetype4_" + b + "_" + a).attr("checked", true);
        checkAImgType(b, a, 4)
    });
    $("#qleftanswerimagewidth_" + b + "_" + a).bind("blur", 
    function(c) {
        if ($.trim($(this).val()) == "") {
            $(this).val(AIMAGE_DEFAULT_WIDTH_TEXT);
            $(this).addClass("gray9")
        }
    });
    $("#qleftanswerimageheight_" + b + "_" + a).bind("focus", 
    function(c) {
        if ($.trim($(this).val()) == AIMAGE_DEFAULT_HEIGHT_TEXT) {
            $(this).val("");
            $(this).removeClass("gray9")
        }
        $("#qleftanswerimagetype4_" + b + "_" + a).attr("checked", true);
        checkAImgType(b, a, 4)
    });
    $("#qleftanswerimageheight_" + b + "_" + a).bind("blur", 
    function(c) {
        if ($.trim($(this).val()) == "") {
            $(this).val(AIMAGE_DEFAULT_HEIGHT_TEXT);
            $(this).addClass("gray9")
        }
    });
    $("#qleftuploadimg_" + b + "_" + a).uploadify({
        uploader: ctx + "/js/uploadify/uploadify.swf?var=" + (new Date()).getTime(),
        script: ctx + "/json/media/uploadpic;jsessionid=" + jsessionid,
        scriptData: {},
        cancelImg: ctx + "/js/uploadify/cancel.png",
        buttonImg: ctx + "/images/picup_btn.gif",
        height: 35,
        folder: "/uploads",
        fileExt: "*.jpg;*.gif;*.png",
        fileDesc: "Image Files(*.jpg, *.gif, *.png)",
        fileDataName: "uploadfile",
        sizeLimit: 2 * 1024 * 1024,
        queueID: "replacing_area_pic",
        onComplete: function(g, c, f, d, h) {
            if (d != "" && d.indexOf("totalSizeLimit") > 0) {
                tips(" 抱歉，超过最大容量限制！", "error", null, 2005);
                return false
            } else {
                var e = $.evalJSON(d);
                if (e.error == "0") {
                    saveQAImgAction(b, a, 1, e.msg)
                } else {
                    tips(" 上传出错，请重新上传！", "error", null, 2005);
                    return false
                }
            }
        },
        onError: function(f, c, e, d) {
            if (d.type == "File Size") {
                tips("抱歉，图片文件应小于2MB！", "error", null, 2005);
                return false
            } else {
                tips(" 图片上传出错，请重新上传！", "error", null, 2005);
                return false
            }
        },
        auto: true
    })
};